package org.anyline.simple.listener;


import org.anyline.entity.DataRow;
import org.anyline.service.AnylineService;
import org.anyline.util.BasicUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication

public class ListenerApplication {

    public static void main(String[] args) {

        SpringApplication application = new SpringApplication(ListenerApplication.class);
        ConfigurableApplicationContext context = application.run(args);

        DataSourceAfterListener listener = context.getBean(DataSourceAfterListener.class);
        AnylineService service = context.getBean(AnylineService.class);

        service.execute("UPDATE CRM_SUER SET CODE = 1  WHERE ID = 1");
        DataRow user = new DataRow();
        user.put("NAME", BasicUtil.getRandomString(10));
        service.insert("CRM_USER", user);

        user  = service.query("CRM_USER");
        System.out.println(user);
        service.save(user);
        service.delete(user);
    }
}
